package net.java.mediasystems.web.bean;

import net.java.mediasystems.database.core.model.MediaQuality;
import net.java.mediasystems.database.core.service.FindableWithNameAndMediaType;
import net.java.mediasystems.database.core.service.MediaQualityService;

public class AddMediaQualityBean extends AbstractAddObjectWithNameAndMediaTypeBean {

	private static final long serialVersionUID = -2622438298776783184L;

	private transient MediaQualityService mediaQualityService;
	
	/**
	 * {@inheritDoc}
	 */
	@Override
	FindableWithNameAndMediaType<MediaQuality> getFindableWithNameAndMediaType() {
		return this.mediaQualityService;
	}
	
	/**
	 * Save the MediaQuality.
	 */
	public void save() {
		MediaQuality mediaQuality = new MediaQuality();
		mediaQuality.setMediaType(this.type);
		mediaQuality.setName(this.name);
		
		this.mediaQualityService.addMediaQuality(mediaQuality);
	}

	public void setMediaQualityService(MediaQualityService mediaQualityService) {
		this.mediaQualityService = mediaQualityService;
	}
}
